﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MaxFramework.Drawing
{
    public class ImageHandler
    {
        public static DateTime? GetDatePictureTaken(string fileName)
        {
            DateTime tResult;

            var t = new ExifReader(fileName);
            if (!t.GetTagValue<DateTime>(ExifTags.DateTime, out tResult))
            {
                if (!t.GetTagValue<DateTime>(ExifTags.DateTimeDigitized, out tResult))
                {
                    t.GetTagValue<DateTime>(ExifTags.DateTimeOriginal, out tResult);
                }
            }
            return tResult;
        }
    }
}
